// 导入React
import React from "react";
// 导入样式文件
import styles from '@/assets/css/user.module.css';
// 导入TabBar组件
import type business from "@/typeof/type";
// 导入BusinessType的数据
import TabBar from "@/components/TabBar";

const Index = () =>
{
    const [business] = useState<business>(React.business);

    const OnLogout = () =>
    {
        React.UI.Dialog.confirm({
            title:'退出账号',
            content:'是否退出当前账号？',
            onConfirm:() => {
                React.success('退出当前账号成功',() =>
                {
                    React.Cookies.remove('business',{path:'/'});
                    React.business = {};

                    React.navigate('/business/login');
                });
            }
        });
    }

    return (
        <>
            <div className={styles.header}>
                <div className={styles.userinfo}>
                    <div className={styles.avatar}>
                        <img src={business.avatar_cdn} alt="" />
                    </div>
                    <div className={styles.nickname}>{business.nickname}</div>
                    {/* <div className={`${styles.nickname} ${styles.content}`}>{business.mobile_text}</div> */}
                </div>
                <div className={styles.corrugated}>
                    <div className={`${styles.wave_top} ${styles.wave_item}`}></div>
                    <div className={`${styles.wave_middle} ${styles.wave_item}`}></div>
                </div>
            </div>
            <div className={styles.menu_cell}>
                <div className={styles.item}>
                    <NavLink to="/business/profile" className={styles.profile}>
                        <div className={styles.title}>个人资料</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </NavLink>
                </div>
                <div className={styles.item}>
                    <NavLink to="/business/email" className={styles.email}>
                        <div className={styles.title}>邮箱认证</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </NavLink>
                </div>
                <div className={styles.item}>
                    <NavLink to="/guest" className={styles.guest}>
                        <div className={styles.title}>住客信息</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </NavLink>
                </div>
                <div className={styles.item}>
                    <NavLink to="/order" className={styles.order}>
                        <div className={styles.title}>房间订单</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </NavLink>
                </div>
                <div className={styles.item}>
                    <NavLink to="/coupon" className={styles.coupon}>
                        <div className={styles.title}>我的优惠券</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </NavLink>
                </div>
                <div className={styles.item}>
                    <NavLink to="/business/about" className={styles.about}>
                        <div className={styles.title}>关于我们</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </NavLink>
                </div>
                <div className={styles.item}>
                    <a onClick={OnLogout}>
                        <div className={styles.title}>退出登陆</div>
                        <div className={styles.icon}>
                            <img src={'/assets/images/right.png'} alt="" />
                        </div>
                    </a>
                </div>
            </div>

            <TabBar />
        </>
    )
}

export default Index;